extends MoveElement


class_name LookElement


## 适配的对象,默认为MoveComponent适配的对象
@export var wrapper: Node2D = null


func on_move_ready() -> void:
    if wrapper == null:
        wrapper = move_component.wrapper

func look_at_wrapper() -> void:
    wrapper.look_at(wrapper.global_position + move_component.direction * 1000)

func on_move_direction_changed() -> void:
    look_at_wrapper()

func yield_move(delta: float) -> Vector2:
    if move_component.is_moving():
        look_at_wrapper()
    return Vector2.ZERO
